\(\int \frac {\cot ^2(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx\) [303]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [A] (verified)
   Fricas [B] (verification not implemented)
   Sympy [B] (verification not implemented)
   Maxima [A] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [B] (verification not implemented)

Optimal result

Integrand size = 34, antiderivative size = 17 \[ \int \frac {\cot ^2(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=-B x-\frac {B \cot (c+d x)}{d} \]

[Out]

-B*x-B*cot(d*x+c)/d

Rubi [A] (verified)

Time = 0.01 (sec) , antiderivative size = 17, normalized size of antiderivative = 1.00, number of steps used = 3, number of rules used = 3, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.088, Rules used = {21, 3554, 8} \[ \int \frac {\cot ^2(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=-\frac {B \cot (c+d x)}{d}-B x \]

[In]

Int[(Cot[c + d*x]^2*(a*B + b*B*Tan[c + d*x]))/(a + b*Tan[c + d*x]),x]

[Out]

-(B*x) - (B*Cot[c + d*x])/d

Rule 8

Int[a_, x_Symbol] :> Simp[a*x, x] /; FreeQ[a, x]

Rule 21

Int[(u_.)*((a_) + (b_.)*(v_))^(m_.)*((c_) + (d_.)*(v_))^(n_.), x_Symbol] :> Dist[(b/d)^m, Int[u*(c + d*v)^(m +
 n), x], x] /; FreeQ[{a, b, c, d, n}, x] && EqQ[b*c - a*d, 0] && IntegerQ[m] && ( !IntegerQ[n] || SimplerQ[c +
 d*x, a + b*x])

Rule 3554

Int[((b_.)*tan[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[b*((b*Tan[c + d*x])^(n - 1)/(d*(n - 1))), x] - Dis
t[b^2, Int[(b*Tan[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1]

Rubi steps \begin{align*} \text {integral}& = B \int \cot ^2(c+d x) \, dx \\ & = -\frac {B \cot (c+d x)}{d}-B \int 1 \, dx \\ & = -B x-\frac {B \cot (c+d x)}{d} \\ \end{align*}

Mathematica [C] (verified)

Result contains higher order function than in optimal. Order 5 vs. order 3 in optimal.

Time = 0.02 (sec) , antiderivative size = 30, normalized size of antiderivative = 1.76 \[ \int \frac {\cot ^2(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=-\frac {B \cot (c+d x) \operatorname {Hypergeometric2F1}\left (-\frac {1}{2},1,\frac {1}{2},-\tan ^2(c+d x)\right )}{d} \]

[In]

Integrate[(Cot[c + d*x]^2*(a*B + b*B*Tan[c + d*x]))/(a + b*Tan[c + d*x]),x]

[Out]

-((B*Cot[c + d*x]*Hypergeometric2F1[-1/2, 1, 1/2, -Tan[c + d*x]^2])/d)

Maple [A] (verified)

Time = 0.16 (sec) , antiderivative size = 22, normalized size of antiderivative = 1.29

method result size
derivativedivides \(\frac {B \left (-\cot \left (d x +c \right )-d x -c \right )}{d}\) \(22\)
default \(\frac {B \left (-\cot \left (d x +c \right )-d x -c \right )}{d}\) \(22\)
risch \(-B x -\frac {2 i B}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}-1\right )}\) \(26\)
parallelrisch \(-\frac {B \left (\tan \left (d x +c \right ) d x +1\right )}{\tan \left (d x +c \right ) d}\) \(26\)
norman \(\frac {-\frac {B}{d}-B x \tan \left (d x +c \right )}{\tan \left (d x +c \right )}\) \(27\)

[In]

int(cot(d*x+c)^2*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c)),x,method=_RETURNVERBOSE)

[Out]

1/d*B*(-cot(d*x+c)-d*x-c)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 42 vs. \(2 (17) = 34\).

Time = 0.25 (sec) , antiderivative size = 42, normalized size of antiderivative = 2.47 \[ \int \frac {\cot ^2(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=-\frac {B d x \sin \left (2 \, d x + 2 \, c\right ) + B \cos \left (2 \, d x + 2 \, c\right ) + B}{d \sin \left (2 \, d x + 2 \, c\right )} \]

[In]

integrate(cot(d*x+c)^2*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c)),x, algorithm="fricas")

[Out]

-(B*d*x*sin(2*d*x + 2*c) + B*cos(2*d*x + 2*c) + B)/(d*sin(2*d*x + 2*c))

Sympy [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 37 vs. \(2 (14) = 28\).

Time = 0.42 (sec) , antiderivative size = 37, normalized size of antiderivative = 2.18 \[ \int \frac {\cot ^2(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=\begin {cases} - B x - \frac {B \cot {\left (c + d x \right )}}{d} & \text {for}\: d \neq 0 \\\frac {x \left (B a + B b \tan {\left (c \right )}\right ) \cot ^{2}{\left (c \right )}}{a + b \tan {\left (c \right )}} & \text {otherwise} \end {cases} \]

[In]

integrate(cot(d*x+c)**2*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c)),x)

[Out]

Piecewise((-B*x - B*cot(c + d*x)/d, Ne(d, 0)), (x*(B*a + B*b*tan(c))*cot(c)**2/(a + b*tan(c)), True))

Maxima [A] (verification not implemented)

none

Time = 0.29 (sec) , antiderivative size = 23, normalized size of antiderivative = 1.35 \[ \int \frac {\cot ^2(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=-\frac {{\left (d x + c\right )} B + \frac {B}{\tan \left (d x + c\right )}}{d} \]

[In]

integrate(cot(d*x+c)^2*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c)),x, algorithm="maxima")

[Out]

-((d*x + c)*B + B/tan(d*x + c))/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 39 vs. \(2 (17) = 34\).

Time = 0.36 (sec) , antiderivative size = 39, normalized size of antiderivative = 2.29 \[ \int \frac {\cot ^2(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=-\frac {2 \, {\left (d x + c\right )} B - B \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + \frac {B}{\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )}}{2 \, d} \]

[In]

integrate(cot(d*x+c)^2*(B*a+b*B*tan(d*x+c))/(a+b*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/2*(2*(d*x + c)*B - B*tan(1/2*d*x + 1/2*c) + B/tan(1/2*d*x + 1/2*c))/d

Mupad [B] (verification not implemented)

Time = 7.12 (sec) , antiderivative size = 16, normalized size of antiderivative = 0.94 \[ \int \frac {\cot ^2(c+d x) (a B+b B \tan (c+d x))}{a+b \tan (c+d x)} \, dx=-\frac {B\,\left (\mathrm {cot}\left (c+d\,x\right )+d\,x\right )}{d} \]

[In]

int((cot(c + d*x)^2*(B*a + B*b*tan(c + d*x)))/(a + b*tan(c + d*x)),x)

[Out]

-(B*(cot(c + d*x) + d*x))/d